<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>补0</title>
</head>

<body>
    <script>
        for (var i = 1; i <= 20; i++) {
            if (i < 10) {
                console.log("0" + i);
            } else {
                console.log(i);
            }

        }

        for (var i = 1; i <= 20; i++) {
            console.log(String(i)[1] && String(i) || '0' + 1);

        }
    </script>
</body>

</html>